#1、在工作台中统一调用测试用例，可以实现一键执行（执行main.py文件就是执行所有的测试用例）
#2、每一条测试用例都写在try except语句中，避免用例出错导致脚本停止
#3、利用exc_info可以把报错的信息也输出出来
#4、执行记录应该放在log.txt文件中，方便脚本执行完成之后查看结果


import sys
import os
print('当前文件的所在目录/',os.path.dirname(__file__))
curPath = os.path.abspath(os.path.dirname(__file__)) #获取当前文件的所在目录的绝对路径
print('当前文件的所在目录\,',curPath)  #C:\Users\xhs\Desktop\dbshop项目相关文档2\dbshop1\main
# 将当前文件的所在目录的绝对路径进行分离,分离成C:\Users\xhs\Desktop\dbshop项目相关文档2\dbshop1  和main,存到元组中
print(os.path.split(curPath))
rootPath = os.path.split(curPath)[0] #[0]表示元组中的第一个元素
print(rootPath)
sys.path.append(rootPath) #用python脚本将路径添加到环境变量中



from public.tools import writeLog



try :
    from testCase import DBshop001_线下支付流程
except:
    writeLog("DBshop001_线下支付流程 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop002_余额支付流程
except:
    writeLog("DBshop002_余额支付流程 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop003_货到付款流程
except:
    writeLog("DBshop003_货到付款流程 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop004_取消订单流程
except:
    writeLog("DBshop004_取消订单流程 执行出错")
    writeLog(str(sys.exc_info()[1]))
#
try :
    from testCase import DBshop005_查询订单流程
except:
    writeLog("DBshop005_查询订单流程 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop006_删除取消的订单
except:
    writeLog("DBshop006_删除取消的订单流程 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop007_查看发货单流程
except:
    writeLog("DBshop007_查询发货单流程 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop008_查看支付记录流程
except:
    writeLog("DBshop008_查询支付记录流程 执行出错")
    writeLog(str(sys.exc_info()[1]))
try :
    from testCase import DBshop009_搜索流程退货流程
except:
    writeLog("DBshop009_搜索退货流程 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop0010_处理退货流程
except:
    writeLog("DBshop0010_处理退货流程 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop0012_搜索商品流程
except:
    writeLog("DBshop0012_搜索商品流程 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop0013_商品分类编辑流程
except:
    writeLog("DBshop0013_商品分类编辑流程 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop0014_删除商品分类测试
except:
    writeLog("DBshop0014_删除商品分类测试 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop0015_添加侧边设置流程
except:
    writeLog("DBshop0015_添加侧边设置流程 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop0016_删除前台侧边流程
except:
    writeLog("DBshop0016_删除前台侧边流程 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop0017_添加属性组流程
except:
    writeLog("DBshop0017_添加属性组流程 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop0018_添加属性流程
except:
    writeLog("DBshop0018_添加属性流程 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop0019_删除属性流程
except:
    writeLog("DBshop0019_删除属性流程 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop0020_删除属性组流程
except:
    writeLog("DBshop0020_删除属性组流程 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop0021_添加品牌流程
except:
    writeLog("DBshop0021_添加品牌流程 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop0022_删除品牌流程
except:
    writeLog("DBshop0022_删除品牌流程 执行出错")
    writeLog(str(sys.exc_info()[1]))


try :
    from testCase import DBshop0023_商品评价流程
except:
    writeLog("DBshop0023_商品评价流程 执行出错")
    writeLog(str(sys.exc_info()[1]))

try :
    from testCase import DBshop0024_删除评价流程
except:
    writeLog("DBshop0024_删除评价流程 执行出错")
    writeLog(str(sys.exc_info()[1]))